//define(function(require,exports){
	angular.module('shopApp')
		.controller('PayCtrl',["$rootScope","$scope","$window","$location","$http", function ($rootScope,$scope,$window,$location,$http) {
			$rootScope.pagetitle = "支付";

			//购物车数据
			$scope.cart =$window.localStorage.cart ? JSON.parse($window.localStorage.cart) : [];
			$scope.qty = $window.localStorage.qty;
			$scope.total = $window.localStorage.total;
			$scope.tocalAmount =  $window.localStorage.tocalAmount;

			//选择支付方式
			$scope.pw = "";
			$scope.pay = function(methed){
				if(methed=="hme"){
				    //显示弹出层
					$scope.showDialog = true;
				}else if(methed=="alipay"){
					$window.location.href="http://www.alipay.com";
				}else if(methed=="wx"){
					$window.location.href="http://www.weixin.com";
				};
			}

			//显示弹出层
			$scope.hideDialog = function(){
				$scope.showDialog = false;
			}

            //验证密码
			$scope.countPw = function(pw){
				if(pw.length>=6){
					//验证支付密码
					var data = "pw="+pw;
					$http.post(hpfbase.url+"##",
						data,
						{headers: {
							'Content-Type': "application/x-www-form-urlencoded;charset=utf-8"
						}}
					)
					.success(function(ret){
                        if(ret.succesed){
							//密码正确，支付链接更改
                           $scope.hasPay ="#/success";
						}else{
						  $scope.hasError = true;
						};
					});
				}
			}
		}]);
//});
